package delete2;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

//服务器端
public class TCP22 {
    public static void main(String[] args) throws Exception {

        ServerSocket socket=new ServerSocket(9292);

        Socket accept = socket.accept();

        InputStream in = accept.getInputStream();

        ByteArrayOutputStream out=new ByteArrayOutputStream();
        byte[] buffer=new byte[1024];
        int len;
        while((len=in.read(buffer))!=-1){
            out.write(buffer,0,len);
        }
        System.out.println(out.toString());

        out.close();
        in.close();
        accept.close();
        socket.close();



    }
}
